home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume0 / awm / part04 < prev    next >
Encoding:
Internet Message Format  |  1988-08-09  |  54.3 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v00i005:  Ardent Window Manager(X11), Part04/13
  5. Message-ID: <1628@wyse.wyse.com>
  6. Date: 9 Aug 88 17:18:02 GMT
  7. Sender: news@wyse.wyse.com
  8. Lines: 1794
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: jkh@ardent (Jordan Hubbard)
  12. Posting-number: Volume 0, Issue 5
  13. Archive-name: awm/part04
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 4 (of 13)."
  22. # Contents:  awm/FocusChng.c awm/Iconify.c awm/Makefile
  23. #   awm/MoveOpaque.c awm/Push.c awm/menu_sup.c awm/menus/menu.def.h
  24. #   awm/menus/menu.h
  25. # Wrapped by mikew@wyse on Mon Aug  8 12:01:43 1988
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f awm/FocusChng.c -a "${1}" != "-c" ; then 
  28.   echo shar: Will not over-write existing file \"awm/FocusChng.c\"
  29. else
  30. echo shar: Extracting \"awm/FocusChng.c\" \(5979 characters\)
  31. sed "s/^X//" >awm/FocusChng.c <<'END_OF_awm/FocusChng.c'
  32. X#ident   "%W% %G%"
  33. X
  34. X
  35. X
  36. X#ifndef lint
  37. Xstatic char *rcsid_FocusChng_c = "$Header: FocusChng.c,v 1.5 88/07/23 17:36:00 jkh Exp $";
  38. X#endif    lint
  39. X
  40. X#include "X11/copyright.h"
  41. X/*
  42. X *
  43. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  44. X *
  45. X * Copyright 1987 by Jordan Hubbard.
  46. X *
  47. X *
  48. X *                         All Rights Reserved
  49. X *
  50. X * Permission to use, copy, modify, and distribute this software and its
  51. X * documentation for any purpose and without fee is hereby granted,
  52. X * provided that the above copyright notice appear in all copies and that
  53. X * both that copyright notice and this permission notice appear in
  54. X * supporting documentation, and that the name of Ardent Computer
  55. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  56. X * pertaining to distribution of the software without specific, written
  57. X * prior permission.
  58. X *
  59. X */
  60. X
  61. X/*
  62. X * MODIFICATION HISTORY
  63. X *
  64. X * 001 -- Jordan Hubbard, U.C. Berkeley.
  65. X *   Hacks for autoraise and titles.
  66. X * 002 -- Jordan Hubbard, Ardent Computer
  67. X *   Window pixmap changes on focus in/out.
  68. X * 1.4 -- Fixed Focus In/Out handling. Created LightsOn() and LightsOff()
  69. X * to break out the actual process of "highlighting".
  70. X * 1.5 -- Added dynamic installation of colormaps.
  71. X */
  72. X
  73. X
  74. X#include "awm.h"
  75. X
  76. X#if defined(sun) || defined(ibm032) || defined(titan) || defined(vax)
  77. X#include <sys/time.h>
  78. X#else
  79. X#include <time.h>
  80. X#endif
  81. X
  82. XWindow FocusWindow;
  83. X
  84. XHandleFocusIn(ev)
  85. XXEvent *ev;
  86. X{
  87. X     XEnterWindowEvent *e = (XEnterWindowEvent *)ev;
  88. X     Window w = e->window;
  89. X     AwmInfoPtr awi;
  90. X     XEvent event;
  91. X
  92. X     Entry("HandleFocusIn")
  93. X
  94. X     if (!(Hilite || Autoraise || InstallColormap) || Snatched)
  95. X     Leave(FALSE)
  96. X
  97. X     awi = GetAwmInfo(w);
  98. X     if (!awi)  /* probably a menu or something */
  99. X         Leave(FALSE)
  100. X     w = (FrameFocus && awi->frame) ? awi->frame : awi->client;
  101. X
  102. X     if (e->detail != NotifyInferior && (e->focus || FrameFocus)) {
  103. X      struct timeval foo;
  104. X
  105. X      if (e->type != FocusIn) {
  106. X           foo.tv_sec = 0;
  107. X           foo.tv_usec = RaiseDelay * 1000; 
  108. X           /*
  109. X        * Sleep for awhile to avoid race conditions and give any
  110. X        * potential leave events a chance to get here..
  111. X        */
  112. X           select(0, 0, 0, 0, &foo);
  113. X           /* Did we leave this window already? */
  114. X           if (XCheckTypedWindowEvent(dpy, w, LeaveNotify, &event))
  115. X            if (event.xcrossing.detail != NotifyInferior)
  116. X             Leave(FALSE)
  117. X           if (InstallColormap) {
  118. X            XWindowAttributes xwa;
  119. X
  120. X            XGetWindowAttributes(dpy, w, &xwa);
  121. X            XInstallColormap(dpy, xwa.colormap);
  122. X           }
  123. X           if (!FocusSetByUser && FocusWindow != awi->client &&
  124. X           (awi->attrs & AT_INPUT)) {
  125. X            if (FrameFocus) {
  126. X             XSetInputFocus(dpy, awi->client, RevertToPointerRoot,
  127. X                    CurrentTime);
  128. X             FocusSetByWM = TRUE;
  129. X            }
  130. X            FocusWindow = awi->client;
  131. X           }
  132. X           else
  133. X            Leave(FALSE)
  134. X      }
  135. X      else {
  136. X           FocusWindow = awi->client;
  137. X           FocusSetByWM = FALSE;
  138. X      }
  139. X
  140. X      /*
  141. X       * If Autoraise is set, raise that puppy..
  142. X       */
  143. X      if (Autoraise && (awi->attrs & AT_RAISE))
  144. X           XRaiseWindow(dpy, (awi->frame) ? awi->frame : awi->client);
  145. X      LightsOn(awi);
  146. X     }
  147. X     Leave(FALSE)
  148. X}
  149. X
  150. XHandleFocusOut(ev)
  151. XXEvent *ev;
  152. X{
  153. X     XLeaveWindowEvent *e = (XEnterWindowEvent *)ev;
  154. X     Window w = e->window;
  155. X     AwmInfoPtr awi;
  156. X     XEvent event;
  157. X
  158. X     Entry("HandleFocusOut")
  159. X
  160. X     awi = GetAwmInfo(w);
  161. X     if (!awi) /* probably a menu or something */
  162. X         Leave(FALSE)
  163. X
  164. X     if (!(Hilite || Autoraise || InstallColormap) || Snatched)
  165. X     Leave(FALSE)
  166. X
  167. X     w =  (FrameFocus && awi->frame) ? awi->frame : awi->client;
  168. X
  169. X     if (e->detail != NotifyInferior && (e->focus || FrameFocus)) {
  170. X      if (e->type != FocusOut) {
  171. X           /* Did we come back into this window? */
  172. X           if (XCheckTypedWindowEvent(dpy, w, EnterNotify, &event)) {
  173. X            if (event.xcrossing.detail != NotifyInferior)
  174. X             Leave(FALSE)
  175. X           }
  176. X           if (!FocusSetByUser) {
  177. X            if (FrameFocus) {
  178. X             XSetInputFocus(dpy, PointerRoot, None, CurrentTime);
  179. X             FocusSetByWM = TRUE;
  180. X            }
  181. X            FocusWindow = RootWindow(dpy, scr);
  182. X           }
  183. X           else
  184. X            Leave(FALSE)
  185. X      }
  186. X      else {
  187. X           FocusWindow = RootWindow(dpy, scr);
  188. X           FocusSetByWM = FALSE;
  189. X      }
  190. X      if (InstallColormap)
  191. X           XInstallColormap(dpy, DefaultColormap(dpy, scr));
  192. X      LightsOff(awi);
  193. X     }
  194. X     Leave(FALSE)
  195. X}
  196. X
  197. X/*
  198. X * Turns higlighting off for a window. Counterpart to LightsOn
  199. X */
  200. XLightsOff(awi)
  201. XAwmInfoPtr awi;
  202. X{
  203. X     Entry("LightsOff")
  204. X
  205. X     /* set the window border to "gray" stipple */
  206. X     if (awi->attrs & AT_INPUT) {
  207. X      if (BorderHilite)
  208. X           SetBorderPixmaps(awi, GrayPixmap);
  209. X      if (awi->frame) {
  210. X           if (awi->back && awi->title)
  211. X            XSetWindowBackgroundPixmap(dpy, awi->title,
  212. X                           awi->back);
  213. X           if (awi->BC_back && (awi->attrs & AT_BORDER)) {
  214. X            XSetWindowBackgroundPixmap(dpy, awi->frame,
  215. X                           awi->BC_back);
  216. X            XClearWindow(dpy, awi->frame);
  217. X           }
  218. X           PaintTitle(awi->title, FALSE);
  219. X      }
  220. X      XSync(dpy, 0);
  221. X     }
  222. X     Leave(FALSE)
  223. X}
  224. X
  225. X
  226. X/*
  227. X * Highlight a window. This may involve shuffling pixmaps around
  228. X * and affecting more than just the client window.
  229. X */
  230. XLightsOn(awi)
  231. XAwmInfoPtr awi;
  232. X{
  233. X     Entry("LightsOn")
  234. X
  235. X     if (awi->attrs & AT_INPUT) {
  236. X      if (BorderHilite)
  237. X           SetBorderPixmaps(awi, SolidPixmap);
  238. X      if (awi->frame) {
  239. X           if (awi->bold && awi->title) {
  240. X            XSetWindowBackgroundPixmap(dpy, awi->title,
  241. X                           awi->bold);
  242. X            PaintTitle(awi->title, TRUE);
  243. X           }
  244. X           if (awi->BC_bold && (awi->attrs & AT_BORDER)) {
  245. X            XSetWindowBackgroundPixmap(dpy, awi->frame,
  246. X                           awi->BC_bold);
  247. X            XClearWindow(dpy, awi->frame);
  248. X           }
  249. X           XSync(dpy, 0);
  250. X      }
  251. X     }
  252. X     Leave(FALSE)
  253. X}
  254. X
  255. Xvoid SetBorderPixmaps(awi, pix)
  256. XAwmInfoPtr awi;
  257. XPixmap pix;
  258. X{
  259. X     Entry("SetBorderPixmaps")
  260. X
  261. X     XSetWindowBorderPixmap(dpy, awi->client, pix);
  262. X     if (awi->frame) {
  263. X      if (awi->title)
  264. X          XSetWindowBorderPixmap(dpy, awi->title, pix);
  265. X      XSetWindowBorderPixmap(dpy, awi->frame, pix);
  266. X     }
  267. X     Leave_void
  268. X}
  269. END_OF_awm/FocusChng.c
  270. if test 5979 -ne `wc -c <awm/FocusChng.c`; then
  271.     echo shar: \"awm/FocusChng.c\" unpacked with wrong size!
  272. fi
  273. # end of overwriting check
  274. fi
  275. if test -f awm/Iconify.c -a "${1}" != "-c" ; then 
  276.   echo shar: Will not over-write existing file \"awm/Iconify.c\"
  277. else
  278. echo shar: Extracting \"awm/Iconify.c\" \(6980 characters\)
  279. sed "s/^X//" >awm/Iconify.c <<'END_OF_awm/Iconify.c'
  280. X#ident   "%W% %G%"
  281. X
  282. X
  283. X
  284. X#ifndef lint
  285. Xstatic char *rcsid_Iconify_c = "$Header: Iconify.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
  286. X#endif  lint
  287. X
  288. X#include "X11/copyright.h"
  289. X/*
  290. X *
  291. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  292. X *
  293. X * Copyright 1987 by Jordan Hubbard.
  294. X *
  295. X *
  296. X *                         All Rights Reserved
  297. X *
  298. X * Permission to use, copy, modify, and distribute this software and its
  299. X * documentation for any purpose and without fee is hereby granted,
  300. X * provided that the above copyright notice appear in all copies and that
  301. X * both that copyright notice and this permission notice appear in
  302. X * supporting documentation, and that the name of Ardent Computer
  303. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  304. X * pertaining to distribution of the software without specific, written
  305. X * prior permission.
  306. X *
  307. X */
  308. X
  309. X/*
  310. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  311. X *
  312. X *                         All Rights Reserved
  313. X *
  314. X * Permission to use, copy, modify, and distribute this software and its
  315. X * documentation for any purpose and without fee is hereby granted,
  316. X * provided that the above copyright notice appear in all copies and that
  317. X * both that copyright notice and this permission notice appear in
  318. X * supporting documentation, and that the name of Digital Equipment
  319. X * Corporation not be used in advertising or publicity pertaining to
  320. X * distribution of the software without specific, written prior permission.
  321. X *
  322. X *
  323. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  324. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  325. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  326. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  327. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  328. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  329. X * SOFTWARE.
  330. X */
  331. X
  332. X
  333. X
  334. X/*
  335. X * MODIFICATION HISTORY
  336. X *
  337. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  338. X * 001 -- R. Kittell, DEC Storage A/D May 20, 1986
  339. X *  Add optional warp of mouse to the upper right corner on de-iconify,
  340. X *  and to the icon center on iconify.
  341. X * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  342. X *  Western Software Lab. Port to X11.
  343. X * 003 -- Jordan Hubbard, Ardent Computer.
  344. X *  Many mods to cope with context manager, titled windows. Almost a total
  345. X *  rewrite.
  346. X */
  347. X
  348. X#include "awm.h"
  349. X
  350. XBoolean Iconify(window, mask, button, x, y)
  351. XWindow window;                          /* Event window. */
  352. Xint mask;                               /* Button/key mask. */
  353. Xint button;                             /* Button event detail. */
  354. Xint x, y;                               /* Event mouse position. */
  355. X{
  356. X     XWindowAttributes fromInfo;    /* info on "from" window */
  357. X     XWindowAttributes toInfo;        /* info on "to" window */
  358. X     int mse_x, mse_y;            /* Mouse X and Y coordinates. */
  359. X     int sub_win_x, sub_win_y;        /* relative Mouse coordinates. */
  360. X     int num_vectors;            /* Number of vectors in zap buffer. */
  361. X     int mmask;                /* Mouse state */
  362. X     Window root;            /* Mouse root window. */
  363. X     Window from, to;            /* from -> to windows */
  364. X     Window sub_win;            /* Mouse position sub-window. */
  365. X     XSegment zap[MAX_ZAP_VECTORS];    /* Zap effect vertex buffer. */
  366. X     Boolean dozap;            /* local Zap */
  367. X     AwmInfoPtr awi;
  368. X
  369. X     Entry("Iconify")
  370. X
  371. X     /*
  372. X      * Do not try to iconify the root window.
  373. X      */
  374. X     if (window == RootWindow(dpy, scr))
  375. X      Leave(FALSE)
  376. X     /*
  377. X      * The original idea of zap lines has one flaw. If a window wants
  378. X      * to be created iconic, it should just appear that way without any
  379. X      * fuss. CheckMap() calls us with (win, 0, 0, 0, 0) when this is the
  380. X      * case, so we can special case this to turn off Zap temporarily.
  381. X      * Since we don't want to mess with the global "Zap", we use
  382. X      * "dozap" instead. 
  383. X      */
  384. X     dozap = (mask || button || x || y) ? Zap : FALSE;
  385. X     /*
  386. X      * Clear the vector buffer.
  387. X      */
  388. X     if (dozap)
  389. X      bzero(zap, sizeof(zap));
  390. X     
  391. X     /*
  392. X      * Get the mouse cursor position in case we must put a new
  393. X      * icon there.
  394. X      */
  395. X     XQueryPointer(dpy, RootWindow(dpy, scr), &root, &sub_win, 
  396. X           &mse_x, &mse_y, &sub_win_x, &sub_win_y, &mmask);
  397. X     
  398. X     
  399. X     /*
  400. X      * Figure out which direction we're going in (icon->window or vica-versa)
  401. X      */
  402. X     awi = GetAwmInfo(window);
  403. X     if (!awi)
  404. X          Leave(FALSE)
  405. X     if (awi->state & ST_ICON) {
  406. X          from = awi->icon;
  407. X          to = (awi->frame) ? awi->frame : awi->client;
  408. X      if (!(awi->state & ST_PLACED))
  409. X           PlaceWindow(to);
  410. X     }
  411. X     else if (awi->state & ST_WINDOW) {
  412. X          from = (awi->frame) ? awi->frame : awi->client;
  413. X          to = (awi->icon) ? awi->icon :  MakeIcon(window, mse_x, mse_y, TRUE);
  414. X     }
  415. X     else {
  416. X          printf("Iconify: Window %x has unknown state '%x'\n",
  417. X         awi->client, awi->state);
  418. X      Leave(FALSE)
  419. X     }
  420. X     status = XGetWindowAttributes(dpy, from, &fromInfo);
  421. X     if (status == FAILURE)
  422. X          Leave(FALSE)
  423. X     status = XGetWindowAttributes(dpy, to, &toInfo);
  424. X     if (status == FAILURE)
  425. X          Leave(FALSE)
  426. X    
  427. X     /*
  428. X      * Store the zap vector buffer.
  429. X      */
  430. X     if (dozap) {
  431. X      num_vectors =
  432. X           StoreZap(zap,
  433. X            fromInfo.x - 1,
  434. X            fromInfo.y - 1,
  435. X            fromInfo.x + fromInfo.width +
  436. X            (fromInfo.border_width << 1),
  437. X            fromInfo.y + fromInfo.height +
  438. X            (fromInfo.border_width << 1),
  439. X            toInfo.x - 1,
  440. X            toInfo.y - 1,
  441. X            toInfo.x + toInfo.width +
  442. X            (toInfo.border_width << 1),
  443. X            toInfo.y + toInfo.height +
  444. X            (toInfo.border_width << 1));
  445. X     }
  446. X     if (awi->state & ST_ICON) {
  447. X      if (!awi->frame)
  448. X           XRemoveFromSaveSet(dpy, awi->client);
  449. X      awi->state ^= ST_ICON;
  450. X      awi->state |= ST_WINDOW;
  451. X     }
  452. X     else if (awi->state & ST_WINDOW) {
  453. X          XAddToSaveSet(dpy, awi->client);
  454. X      awi->state ^= ST_WINDOW;
  455. X      awi->state |= ST_ICON;
  456. X     }
  457. X     else
  458. X          fprintf(stderr, "Window state for window %x got munged!\n",
  459. X             awi->client);
  460. X     /*
  461. X      * Map the target.
  462. X      */
  463. X     XMapRaised(dpy, to);
  464. X     if (dozap) {
  465. X      /*
  466. X       * Draw the zap lines.
  467. X       */
  468. X      DrawZap();
  469. X     }
  470. X     /*
  471. X      * Unmap the "from" window.
  472. X      */
  473. X     XUnmapWindow(dpy, from);
  474. X     XFlush(dpy);
  475. X     /*
  476. X      * Optionally warp the mouse to the upper right corner of the
  477. X      *  window.
  478. X      */
  479. X     if (WarpOnDeIconify && awi->state & ST_WINDOW) {
  480. X      int y;
  481. X
  482. X      y = (toInfo.height >= 10) ? 10 : toInfo.height / 2;
  483. X      if (awi->frame) { /* compensate for title */
  484. X           XWindowAttributes xwa;
  485. X           XGetWindowAttributes(dpy, awi->title, &xwa);
  486. X           y += xwa.height + 2;
  487. X      }
  488. X      status = XWarpPointer (dpy, None, to,
  489. X                 0, 0, 0, 0,
  490. X                 toInfo.width >= 7 ?
  491. X                 toInfo.width - 7 : toInfo.width / 2,
  492. X                 y);
  493. X     }
  494. X
  495. X     if (WarpOnIconify && awi->state & ST_ICON)
  496. X      status = XWarpPointer (dpy, None, to, 
  497. X                 0, 0, 0, 0,
  498. X                 toInfo.width / 2, toInfo.height / 2);
  499. X     Leave(FALSE)
  500. X}
  501. END_OF_awm/Iconify.c
  502. if test 6980 -ne `wc -c <awm/Iconify.c`; then
  503.     echo shar: \"awm/Iconify.c\" unpacked with wrong size!
  504. fi
  505. # end of overwriting check
  506. fi
  507. if test -f awm/Makefile -a "${1}" != "-c" ; then 
  508.   echo shar: Will not over-write existing file \"awm/Makefile\"
  509. else
  510. echo shar: Extracting \"awm/Makefile\" \(6591 characters\)
  511. sed "s/^X//" >awm/Makefile <<'END_OF_awm/Makefile'
  512. X#
  513. X# Warning: the cpp used on this machine replaces
  514. X# all newlines and multiple tabs/spaces in a macro
  515. X# expansion with a single space.  Imake tries to
  516. X# compensate for this, but is not always
  517. X# successful.
  518. X#
  519. X
  520. X#
  521. X# This makefile is automatically generated by imake... do not modify
  522. X# or you may lose your changes when imake generates makefiles again.
  523. X# Ignore this message if you are not using imake.
  524. X#
  525. X
  526. X            TOP = /usr/new/src/x/x11.2
  527. X             AS = as
  528. X             CC = cc
  529. X            CPP = /lib/cpp
  530. X             LD = ld
  531. X           LINT = lint
  532. X        INSTALL = install
  533. X           TAGS = ctags
  534. X             RM = rm -f
  535. X             MV = mv
  536. X             LN = ln -s
  537. X         RANLIB = ranlib
  538. X             AR = ar clq
  539. X             LS = ls
  540. X       LINTOPTS = -axz
  541. X    LINTLIBFLAG = -C
  542. X           MAKE = make
  543. X    STD_DEFINES =
  544. X    CDEBUGFLAGS = -O4
  545. X        DESTDIR = /usr/new
  546. X
  547. X        PATHSEP = /
  548. X         DEPEND = $(DEPENDSRC)/makedepend
  549. X          IMAKE = $(IMAKESRC)/imake
  550. X            RGB = $(RGBSRC)/rgb
  551. X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
  552. X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
  553. X        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
  554. X   INSTUIDFLAGS = -m 4755
  555. X   INSTLIBFLAGS = -m 0664
  556. X   INSTINCFLAGS = -m 0444
  557. X   INSTMANFLAGS = -m 0444
  558. X   INSTAPPFLAGS = -m 0444
  559. X
  560. X      USRLIBDIR = $(DESTDIR)/usr/lib
  561. X         BINDIR = $(DESTDIR)/usr/bin/X11
  562. X         LIBDIR = $(USRLIBDIR)/X11
  563. X     LINTLIBDIR = $(USRLIBDIR)/lint
  564. X         INCDIR = $(DESTDIR)/usr/include/X11
  565. X        FONTDIR = $(LIBDIR)/fonts
  566. X         UWMDIR = $(LIBDIR)/uwm
  567. X         AWMDIR = $(LIBDIR)/awm
  568. X         MANDIR = $(DESTDIR)/usr/man/mann
  569. X    XAPPLOADDIR = $(LIBDIR)/app-defaults
  570. X         ADMDIR = $(DESTDIR)/usr/adm
  571. X
  572. X      CLIENTSRC = $(TOP)/clients
  573. X        DEMOSRC = $(TOP)/demos
  574. X         LIBSRC = $(TOP)/lib
  575. X        FONTSRC = $(TOP)/fonts
  576. X     INCLUDESRC = $(TOP)/X11
  577. X      SERVERSRC = $(TOP)/server
  578. X        UTILSRC = $(TOP)/util
  579. X     EXAMPLESRC = $(TOP)/examples
  580. X     CONTRIBSRC = $(TOP)/contrib
  581. X         DOCSRC = $(TOP)/doc
  582. X      DEPENDSRC = $(UTILSRC)/makedepend
  583. X       IMAKESRC = $(UTILSRC)/imake
  584. X       IRULESRC = $(UTILSRC)/imake.includes
  585. X         RGBSRC = $(UTILSRC)/rgb
  586. X        XLIBSRC = $(LIBSRC)/X
  587. X     TOOLKITSRC = $(LIBSRC)/Xt
  588. X     AWIDGETSRC = $(LIBSRC)/Xaw
  589. X     OLDXLIBSRC = $(LIBSRC)/oldX
  590. X   EXTENSIONSRC = $(TOP)/extensions
  591. X        XMANSRC = $(DOCSRC)/Xlib/Xman
  592. X   EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a
  593. X           XLIB = $(USRLIBDIR)/libX11.a
  594. X        OLDXLIB = $(OLDXLIBSRC)/liboldX.a
  595. X       XTOOLLIB = $(TOOLKITSRC)/libXt.a
  596. X         XAWLIB = $(AWIDGETSRC)/libXaw.a
  597. X       LINTXLIB = $(XLIBSRC)/llib-lX11.ln
  598. X      LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
  599. X        LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
  600. X       INCLUDES = -I$(TOP)
  601. X      MACROFILE = Sun.macros
  602. X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl \
  603. X            -I$(NEWTOP)$(IRULESRC) \
  604. X            -s Makefile
  605. X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
  606. X            tags TAGS make.log
  607. X
  608. X       MENU_LIB = menus
  609. X      MENU_ARCH = $(MENU_LIB)/rtlmenu.a
  610. X     NEATEN_LIB = /grgr/neaten
  611. X    NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
  612. X  SYS_LIBRARIES = -ll
  613. X      OTHERSRCS = gram.y lex.l
  614. X         YFLAGS = -d
  615. X         HFILES = awm.h neaten.def.h neaten.ext.h support.h
  616. X
  617. X# Add the line -DCONSOLE to the appropriate DEFINES macro (see below) if
  618. X# you want output (stderr and stdout) to go to the system console.
  619. X#
  620. X
  621. X# Use these macros if you want the RTL Neaten package.
  622. X# Also make sure that NEATEN_LIB points to the right place. See the README
  623. X# file for instructions (though you can just define this and give it a shot).
  624. X#       DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DNEATEN
  625. X#       LOCAL_LIBRARIES = $(NEATEN_ARCH) $(MENU_ARCH) $(XLIB)
  626. X
  627. X# Use these macros if you don't want the RTL Neaten package.
  628. X        DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\"
  629. X        LOCAL_LIBRARIES = $(MENU_ARCH) $(XLIB)
  630. X
  631. X# Define this if you're compiling XReadBitmapFileData with awm, rather
  632. X# than with Xlib. No guarantees that this will work with all source trees.
  633. X# To be totally sure, compile it with Xlib.
  634. X#XRDOBJ=XRdBitFD.o
  635. X
  636. X# Below is just for "make noident", remove it if you've moved XRdBitFD.c
  637. X# someplace else.
  638. XXRDSRC=XRdBitFD.c
  639. X
  640. XSRCS=    globals.c Beep.c Bindings.c CircleDown.c CircleUp.c\
  641. X    Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
  642. X    Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
  643. X    Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
  644. X    StoreZap.c XError.c awm.c FocusChng.c Titlebar.c errHndlr.c \
  645. X    Grab.c menu_sup.c Gadget.c support.c exp_path.c Neaten.c
  646. X
  647. XOBJS=    gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
  648. X    Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
  649. X    Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
  650. X    Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
  651. X    StoreZap.o XError.o awm.o FocusChng.o Titlebar.o errHndlr.o \
  652. X    Grab.o menu_sup.o Gadget.o support.o exp_path.o Neaten.o $(XRDOBJ)
  653. X
  654. X PROGRAM = awm
  655. X
  656. Xall:: awm
  657. X
  658. Xawm: $(OBJS) $(LOCAL_LIBRARIES)
  659. X    $(RM) $@
  660. X    $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS)
  661. X
  662. Xrelink::
  663. X    $(RM) $(PROGRAM)
  664. X    $(MAKE) $(MFLAGS) $(PROGRAM)
  665. X
  666. Xinstall:: awm
  667. X    $(INSTALL) -c $(INSTALLFLAGS) awm $(BINDIR)
  668. X
  669. Xdepend:: $(DEPEND)
  670. X
  671. Xdepend::
  672. X    $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
  673. X
  674. X$(DEPEND):
  675. X    @echo "making $(DEPENDSRC)"; \
  676. X    cd $(DEPENDSRC); $(MAKE)
  677. X
  678. Xclean::
  679. X    $(RM) $(PROGRAM)
  680. X
  681. Xinstall:: system.awmrc
  682. X    $(INSTALL) -c $(INSTALLFLAGS) system.awmrc  $(AWMDIR)
  683. X
  684. X$(MENU_ARCH)::
  685. X    @echo Making menu package...
  686. X    @(cd $(MENU_LIB); make CC=$(CC) CFLAGS="$(CFLAGS)")
  687. X    @echo done.
  688. X
  689. X$(NEATEN_ARCH)::
  690. X    cp Makefile.rtl $(NEATEN_LIB)/Makefile
  691. X    @echo Making Neaten package
  692. X    @(cd $(NEATEN_LIB); make -f Makefile)
  693. X    @echo done.
  694. X
  695. Xclean::
  696. X    @echo Cleaning menus...
  697. X    @(cd $(MENU_LIB); make clean)
  698. X    @echo done.
  699. X    rm -f y.tab.h
  700. X
  701. Xnoident::
  702. X    @echo Removing ident lines from awm...
  703. X    @for i in $(SRCS) $(OTHERSRCS) $(HFILES) $(XRDSRC); do \
  704. X    sed -e '/#ident/D' < $$i > /tmp/x.$$i && \
  705. X    mv /tmp/x.$$i $$i ; \
  706. X    done
  707. X    @(cd $(MENU_LIB); make noident)
  708. X    @echo done.
  709. X
  710. XXRdBitFD.o:
  711. X    $(CC) -c -I$(XLIBSRC) -I$(TOP) -I$(INCLUDESRC) XRdBitFD.c
  712. X
  713. Xclean::
  714. X    $(RM_CMD) \#*
  715. X
  716. XMakefile:: $(IMAKE)
  717. X
  718. XMakefile:: Imakefile \
  719. X    $(IRULESRC)/Imake.tmpl \
  720. X    $(IRULESRC)/Imake.rules \
  721. X    $(IRULESRC)/$(MACROFILE)
  722. X    -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak
  723. X    $(IMAKE_CMD) -DTOPDIR=$(TOP)
  724. X
  725. X$(IMAKE):
  726. X    @echo "making $(IMAKESRC)"; \
  727. X    cd $(IMAKESRC); $(MAKE)
  728. X
  729. Xtags::
  730. X    $(TAGS) -w *.[ch]
  731. X    $(TAGS) -xw *.[ch] > TAGS
  732. X
  733. Xinstall::
  734. X    @echo "install done"
  735. X
  736. XMakefiles::
  737. X
  738. END_OF_awm/Makefile
  739. if test 6591 -ne `wc -c <awm/Makefile`; then
  740.     echo shar: \"awm/Makefile\" unpacked with wrong size!
  741. fi
  742. # end of overwriting check
  743. fi
  744. if test -f awm/MoveOpaque.c -a "${1}" != "-c" ; then 
  745.   echo shar: Will not over-write existing file \"awm/MoveOpaque.c\"
  746. else
  747. echo shar: Extracting \"awm/MoveOpaque.c\" \(5297 characters\)
  748. sed "s/^X//" >awm/MoveOpaque.c <<'END_OF_awm/MoveOpaque.c'
  749. X#ident   "%W% %G%"
  750. X
  751. X
  752. X
  753. X#ifndef lint
  754. Xstatic char *rcsid_MoveOpaque_c = "$Header: MoveOpaque.c,v 1.1 88/06/15 15:26:34 jkh Exp $";
  755. X#endif    lint
  756. X
  757. X#include "X11/copyright.h"
  758. X/*
  759. X *
  760. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  761. X *
  762. X * Copyright 1987 by Jordan Hubbard.
  763. X *
  764. X *
  765. X *                         All Rights Reserved
  766. X *
  767. X * Permission to use, copy, modify, and distribute this software and its
  768. X * documentation for any purpose and without fee is hereby granted,
  769. X * provided that the above copyright notice appear in all copies and that
  770. X * both that copyright notice and this permission notice appear in
  771. X * supporting documentation, and that the name of Ardent Computer
  772. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  773. X * pertaining to distribution of the software without specific, written
  774. X * prior permission.
  775. X *
  776. X */
  777. X
  778. X/*
  779. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  780. X *
  781. X *                         All Rights Reserved
  782. X *
  783. X * Permission to use, copy, modify, and distribute this software and its
  784. X * documentation for any purpose and without fee is hereby granted,
  785. X * provided that the above copyright notice appear in all copies and that
  786. X * both that copyright notice and this permission notice appear in
  787. X * supporting documentation, and that the name of Digital Equipment
  788. X * Corporation not be used in advertising or publicity pertaining to
  789. X * distribution of the software without specific, written prior permission.
  790. X *
  791. X *
  792. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  793. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  794. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  795. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  796. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  797. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  798. X * SOFTWARE.
  799. X */
  800. X
  801. X
  802. X
  803. X/*
  804. X * MODIFICATION HISTORY
  805. X *
  806. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  807. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  808. X * Western Software Lab. Convert to X11.
  809. X * 002 -- Jordan Hubbard, Ardent Computer
  810. X *  Changed to work with awm.
  811. X */
  812. X
  813. X#include "awm.h"
  814. X
  815. XBoolean MoveOpaque(window, mask, button, x, y)
  816. XWindow window;                /* Event window. */
  817. Xint mask;                /* Button/key mask. */
  818. Xint button;                /* Button event detail. */
  819. Xint x, y;                /* Event mouse position. */
  820. X{
  821. X     int prev_x, prev_y;        /* Previous mouse location. */
  822. X     int rbound, dbound;        /* potential right/down boundries */
  823. X     int cur_x, cur_y;            /* Current mouse location. */
  824. X     int win_x, win_y;            /* Current window location. */
  825. X     int root_x;            /* Root window X location. */
  826. X     int root_y;            /* Root window Y location. */
  827. X     int ptrmask;            /* state of ptr when queried */
  828. X     XWindowAttributes window_info;    /* Event window information. */
  829. X     Window sub_window;            /* Query mouse event sub-window. */
  830. X     Window root;            /* Query mouse event root. */
  831. X     XEvent button_event;        /* Button event packet. */
  832. X     
  833. X     Entry("MoveOpaque")
  834. X
  835. X     /*
  836. X      * Do not try to move the root window.
  837. X      */
  838. X     if (window == RootWindow(dpy, scr))
  839. X      Leave(FALSE)
  840. X        
  841. X     /*
  842. X      * Change the cursor.
  843. X      */
  844. X     grab_pointer();
  845. X     
  846. X     /*
  847. X      * Gather info on the event window.
  848. X      */
  849. X     status = XGetWindowAttributes(dpy, window, &window_info);
  850. X     if (status == FAILURE)
  851. X      Leave(FALSE)
  852. X
  853. X     /*
  854. X      * Initialize movement variables.
  855. X      */
  856. X     prev_x = cur_x = x;
  857. X     prev_y = cur_y = y;
  858. X     win_x = window_info.x;
  859. X     win_y = window_info.y;
  860. X     rbound = ScreenWidth - (window_info.width + window_info.border_width);
  861. X     dbound = ScreenHeight - (window_info.height + window_info.border_width);
  862. X
  863. X     /*
  864. X      * Main loop.
  865. X      */
  866. X     while (TRUE) {
  867. X      
  868. X      /*
  869. X       * Check to see if we have a change in mouse button status.
  870. X       * This is how we get out of this "while" loop.
  871. X       */
  872. X      if (XCheckMaskEvent(dpy,
  873. X                  ButtonPressMask | ButtonReleaseMask,
  874. X                  &button_event)) {
  875. X           
  876. X           /*
  877. X        * If the button event was something other than the
  878. X        * release of the original button pressed, then move the
  879. X        * window back to where it was originally.
  880. X        */
  881. X           if ((button_event.type != ButtonRelease) ||
  882. X           (((XButtonReleasedEvent *)&button_event)->button
  883. X            != button)) {
  884. X            ResetCursor(button);
  885. X            XMoveWindow(dpy, window, window_info.x, window_info.y);
  886. X           }
  887. X           ungrab_pointer();
  888. X           Leave(TRUE);
  889. X      }
  890. X      
  891. X      /*
  892. X       * Take care of all the little things that have changed; 
  893. X       * i.e., move the window, if necessary.
  894. X       */
  895. X      XQueryPointer(dpy, RootWindow(dpy, scr), 
  896. X            &root, &sub_window, &root_x, &root_y, &cur_x, &cur_y, 
  897. X            &ptrmask);
  898. X      if ((cur_x != prev_x) || (cur_y != prev_y)) {
  899. X           win_x += (cur_x - prev_x);
  900. X           win_y += (cur_y - prev_y);
  901. X#ifdef titan /* align to 5x4 */
  902. X           win_x += (win_x % 5);
  903. X           win_y += (win_y % 4);
  904. X#endif /* titan */
  905. X           if (Wall) {
  906. X            if (win_x < 0)
  907. X             win_x = 0;
  908. X            else if (win_x > rbound)
  909. X             win_x = rbound;
  910. X            if (win_y < 0)
  911. X             win_y = 0;
  912. X            else if (win_y > dbound)
  913. X             win_y = dbound;
  914. X            }
  915. X           XMoveWindow(dpy, window, win_x, win_y);
  916. X           prev_x = cur_x;
  917. X           prev_y = cur_y;
  918. X      }
  919. X     }
  920. X}
  921. END_OF_awm/MoveOpaque.c
  922. if test 5297 -ne `wc -c <awm/MoveOpaque.c`; then
  923.     echo shar: \"awm/MoveOpaque.c\" unpacked with wrong size!
  924. fi
  925. # end of overwriting check
  926. fi
  927. if test -f awm/Push.c -a "${1}" != "-c" ; then 
  928.   echo shar: Will not over-write existing file \"awm/Push.c\"
  929. else
  930. echo shar: Extracting \"awm/Push.c\" \(5297 characters\)
  931. sed "s/^X//" >awm/Push.c <<'END_OF_awm/Push.c'
  932. X#ident   "%W% %G%"
  933. X
  934. X
  935. X
  936. X#ifndef lint
  937. Xstatic char *rcsid_Push_c = "$Header: Push.c,v 1.1 88/06/15 15:21:37 jkh Exp $";
  938. X#endif    lint
  939. X
  940. X#include "X11/copyright.h"
  941. X/*
  942. X *
  943. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  944. X *
  945. X * Copyright 1987 by Jordan Hubbard.
  946. X *
  947. X *
  948. X *                         All Rights Reserved
  949. X *
  950. X * Permission to use, copy, modify, and distribute this software and its
  951. X * documentation for any purpose and without fee is hereby granted,
  952. X * provided that the above copyright notice appear in all copies and that
  953. X * both that copyright notice and this permission notice appear in
  954. X * supporting documentation, and that the name of Ardent Computer
  955. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  956. X * pertaining to distribution of the software without specific, written
  957. X * prior permission.
  958. X *
  959. X */
  960. X
  961. X/*
  962. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  963. X *
  964. X *                         All Rights Reserved
  965. X *
  966. X * Permission to use, copy, modify, and distribute this software and its
  967. X * documentation for any purpose and without fee is hereby granted,
  968. X * provided that the above copyright notice appear in all copies and that
  969. X * both that copyright notice and this permission notice appear in
  970. X * supporting documentation, and that the name of Digital Equipment
  971. X * Corporation not be used in advertising or publicity pertaining to
  972. X * distribution of the software without specific, written prior permission.
  973. X *
  974. X *
  975. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  976. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  977. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  978. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  979. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  980. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  981. X * SOFTWARE.
  982. X */
  983. X
  984. X
  985. X/*
  986. X * MODIFICATION HISTORY
  987. X *
  988. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  989. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  990. X    Western Software Lab. Convert to X11.
  991. X */
  992. X
  993. X#include "awm.h"
  994. X
  995. X#define SHOVE_DOWN    1
  996. X#define SHOVE_UP        2
  997. X#define SHOVE_LEFT    3
  998. X#define SHOVE_RIGHT    4
  999. X
  1000. Xextern Boolean ShoveAll();
  1001. X
  1002. XBoolean ShoveDown(window, mask, button, x, y)
  1003. XWindow window;                /* Event window. */
  1004. Xint mask;                /* Button/key mask. */
  1005. Xint button;                /* Button event detail. */
  1006. Xint x, y;                /* Event mouse position. */
  1007. X{
  1008. X    Entry("ShoveDown")
  1009. X
  1010. X    Leave(ShoveAll(window, SHOVE_DOWN))
  1011. X}
  1012. X
  1013. XBoolean ShoveUp(window, mask, button, x, y)
  1014. XWindow window;                /* Event window. */
  1015. Xint mask;                /* Button/key mask. */
  1016. Xint button;                /* Button event detail. */
  1017. Xint x, y;                /* Event mouse position. */
  1018. X{
  1019. X    Entry("ShoveUp")
  1020. X
  1021. X    Leave(ShoveAll(window, SHOVE_UP))
  1022. X}
  1023. X
  1024. XBoolean ShoveLeft(window, mask, button, x, y)
  1025. XWindow window;                /* Event window. */
  1026. Xint mask;                /* Button/key mask. */
  1027. Xint button;                /* Button event detail. */
  1028. Xint x, y;                /* Event mouse position. */
  1029. X{
  1030. X    Entry("ShoveLeft")
  1031. X
  1032. X    Leave(ShoveAll(window, SHOVE_LEFT))
  1033. X}
  1034. X
  1035. XBoolean ShoveRight(window, mask, button, x, y)
  1036. XWindow window;                /* Event window. */
  1037. Xint mask;                /* Button/key mask. */
  1038. Xint button;                /* Button event detail. */
  1039. Xint x, y;                /* Event mouse position. */
  1040. X{
  1041. X    Entry("ShoveRight")
  1042. X
  1043. X    Leave(ShoveAll(window, SHOVE_RIGHT))
  1044. X}
  1045. X
  1046. XBoolean ShoveAll(w, direction)
  1047. XWindow w;
  1048. Xint direction;
  1049. X{
  1050. X    XWindowAttributes winfo;            /* Event window information. */
  1051. X    XWindowAttributes rinfo;            /* Root window information. */
  1052. X    int xofs, yofs;            /* Movement offsets. */
  1053. X    int x, y;                /* New window position. */
  1054. X
  1055. X    Entry("ShoveAll")
  1056. X
  1057. X    /*
  1058. X     * Do not try to move the root window.
  1059. X     */
  1060. X    if (w == RootWindow(dpy, scr))
  1061. X        Leave(FALSE)
  1062. X
  1063. X    /*
  1064. X     * Gather info on the event window.
  1065. X     */
  1066. X    status = XGetWindowAttributes(dpy, w, &winfo);
  1067. X    if (status == FAILURE) Leave(FALSE)
  1068. X    if (!Pushval && Push)
  1069. X     Pushval = DEF_PUSH;
  1070. X
  1071. X    /*
  1072. X     * Calculate the movement offsets.
  1073. X     */
  1074. X    switch(direction) {
  1075. X    case SHOVE_DOWN:
  1076. X        xofs = 0;
  1077. X        yofs = Push ? (winfo.height / Pushval) : Pushval;
  1078. X        break;
  1079. X    case SHOVE_UP:
  1080. X        xofs = 0;
  1081. X        yofs = 0 - (Push ? (winfo.height / Pushval) : Pushval);
  1082. X        break;
  1083. X    case SHOVE_LEFT:
  1084. X        xofs = 0 - (Push ? (winfo.width / Pushval) : Pushval);
  1085. X        yofs = 0;
  1086. X        break;
  1087. X    case SHOVE_RIGHT:
  1088. X        xofs = Push ? (winfo.width / Pushval) : Pushval;
  1089. X        yofs = 0;
  1090. X        break;
  1091. X    }
  1092. X
  1093. X    /*
  1094. X     * Calculate the new window position.
  1095. X     */
  1096. X    x = winfo.x + xofs;
  1097. X    y = winfo.y + yofs;
  1098. X
  1099. X    /*
  1100. X     * Normalize the new window coordinates so we don't
  1101. X     * lose the window off the edge of the screen.
  1102. X     */
  1103. X    if (x < (0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1)))
  1104. X        x = 0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1);
  1105. X    if (y < (0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1)))
  1106. X        y = 0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1);
  1107. X    if (x > (ScreenWidth - CURSOR_WIDTH))
  1108. X        x = ScreenWidth - CURSOR_WIDTH;
  1109. X    if (y > (ScreenHeight - CURSOR_HEIGHT))
  1110. X        y = ScreenHeight - CURSOR_HEIGHT;
  1111. X
  1112. X    /*
  1113. X     * Move the window into place.
  1114. X     */
  1115. X    XMoveWindow(dpy, w, x, y);
  1116. X
  1117. X    Leave(FALSE)
  1118. X}
  1119. END_OF_awm/Push.c
  1120. if test 5297 -ne `wc -c <awm/Push.c`; then
  1121.     echo shar: \"awm/Push.c\" unpacked with wrong size!
  1122. fi
  1123. # end of overwriting check
  1124. fi
  1125. if test -f awm/menu_sup.c -a "${1}" != "-c" ; then 
  1126.   echo shar: Will not over-write existing file \"awm/menu_sup.c\"
  1127. else
  1128. echo shar: Extracting \"awm/menu_sup.c\" \(6167 characters\)
  1129. sed "s/^X//" >awm/menu_sup.c <<'END_OF_awm/menu_sup.c'
  1130. X#ident   "%W% %G%"
  1131. X
  1132. X
  1133. X
  1134. X#ifndef lint
  1135. Xstatic char *rcsid_menu_sup_c = "$Header: menu_sup.c,v 1.1 88/06/15 15:24:56 jkh Exp $";
  1136. X#endif  lint
  1137. X
  1138. X#include "X11/copyright.h"
  1139. X/*
  1140. X *
  1141. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1142. X *
  1143. X * Copyright 1987 by Jordan Hubbard.
  1144. X *
  1145. X *
  1146. X *                         All Rights Reserved
  1147. X *
  1148. X * Permission to use, copy, modify, and distribute this software and its
  1149. X * documentation for any purpose and without fee is hereby granted,
  1150. X * provided that the above copyright notice appear in all copies and that
  1151. X * both that copyright notice and this permission notice appear in
  1152. X * supporting documentation, and that the name of Ardent Computer
  1153. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1154. X * pertaining to distribution of the software without specific, written
  1155. X * prior permission.
  1156. X *
  1157. X */
  1158. X
  1159. X#include "awm.h"
  1160. X#include <signal.h>
  1161. X#
  1162. X
  1163. X/* interface functions for RTL menus */
  1164. X
  1165. Xdo_nothing()    /* like it says... */
  1166. X{
  1167. X}
  1168. X
  1169. XBoolean check_booleans(menu, item)
  1170. XRTLMenu menu;
  1171. XRTLMenuItem item;
  1172. X{
  1173. X     Boolean *foo;
  1174. X
  1175. X     Entry("check_booleans")
  1176. X
  1177. X     foo = (Boolean *)RTLMenu_Data(menu, item);
  1178. X     Leave(*foo)
  1179. X}
  1180. X
  1181. XBoolean toggle_booleans(menu, item)
  1182. XRTLMenu menu;
  1183. XRTLMenuItem item;
  1184. X{
  1185. X     Boolean *foo;
  1186. X
  1187. X     Entry("togglet_booleans")
  1188. X
  1189. X     foo = (Boolean *)RTLMenu_Data(menu, item);
  1190. X     *foo = !(*foo);
  1191. X     Leave(*foo)
  1192. X}
  1193. X
  1194. Xint do_shell(menu, item, window)    /* Do a shell command */
  1195. XRTLMenu menu;
  1196. XRTLMenuItem item;
  1197. XWindow window;            /* not used */
  1198. X{
  1199. X     char *cmd;
  1200. X     int status, pid, w;
  1201. X     register int (*istat)(), (*qstat)();
  1202. X
  1203. X     Entry("do_shell")
  1204. X
  1205. X     cmd = (char *)RTLMenu_Data(menu, item);
  1206. X     if ((pid = fork()) == 0) {
  1207. X      setpgrp(0, 0);
  1208. X          signal(SIGHUP, SIG_IGN);
  1209. X          signal(SIGQUIT, SIG_IGN);
  1210. X          signal(SIGINT, SIG_IGN);
  1211. X      execl("/bin/sh", "sh", "-c", cmd, 0);
  1212. X      _exit(127);
  1213. X     }
  1214. X     istat = signal(SIGINT, SIG_IGN);
  1215. X     qstat = signal(SIGQUIT, SIG_IGN);
  1216. X     while ((w = wait(&status)) != pid && w != -1);
  1217. X     if (w == -1)
  1218. X      status = -1;
  1219. X     signal(SIGINT, istat);
  1220. X     signal(SIGQUIT, qstat);
  1221. X     Leave(status)
  1222. X}
  1223. X
  1224. Xint do_text(menu, item, window)
  1225. XRTLMenu menu;
  1226. XRTLMenuItem item;
  1227. XWindow window;
  1228. X{
  1229. X     char *buff;
  1230. X
  1231. X     Entry("do_text")
  1232. X
  1233. X     buff = (char *)RTLMenu_Data(menu, item);
  1234. X     XStoreBytes(dpy, buff, strlen(buff));
  1235. X     Leave_void
  1236. X}
  1237. X
  1238. Xint do_text_nl(menu, item, window)
  1239. XRTLMenu menu;
  1240. XRTLMenuItem item;
  1241. XWindow window;
  1242. X{
  1243. X     char *buff1, *buff2;
  1244. X
  1245. X     Entry("do_text_nl")
  1246. X
  1247. X     buff1 = (char *)RTLMenu_Data(menu, item);
  1248. X     buff2 = (char *)malloc(strlen(buff1) + 2);
  1249. X     strcpy(buff2, buff1);
  1250. X     strcat(buff2, "\n");
  1251. X     XStoreBytes(dpy, buff2, strlen(buff2));
  1252. X     free(buff2);
  1253. X     Leave_void
  1254. X}
  1255. X
  1256. Xint do_awm_func(menu, item, window)
  1257. XRTLMenu menu;
  1258. XRTLMenuItem item;
  1259. XWindow window;
  1260. X{
  1261. X     int x, y, button;
  1262. X     Boolean (*func)();
  1263. X
  1264. X     Entry("do_awm_func")
  1265. X
  1266. X     XSync(dpy, FALSE);
  1267. X     if (window == RootWindow(dpy, scr))
  1268. X          window = Select_Window(&x, &y, &button);
  1269. X     func = (Boolean(*)())RTLMenu_Data(menu, item);
  1270. X     Leave((*func)(window, 0, button, x, y))
  1271. X}
  1272. X
  1273. Xint do_imm_func(menu, item, window)
  1274. XRTLMenu menu;
  1275. XRTLMenuItem item;
  1276. XWindow window;
  1277. X{
  1278. X     Boolean (*func)();
  1279. X
  1280. X     Entry("do_imm_func")
  1281. X
  1282. X     func = (Boolean(*)())RTLMenu_Data(menu, item);
  1283. X     Leave((*func)(RootWindow(dpy, scr), 0, 0, 0, 0))
  1284. X}
  1285. X
  1286. XMenuInfo *FindMenu(s)
  1287. Xregister char *s;
  1288. X{
  1289. X     MenuLink *ml;
  1290. X
  1291. X     Entry("FindMenu")
  1292. X
  1293. X     for (ml = Menus; ml; ml = ml->next)
  1294. X      if (!strcmp(s, ml->menu->name))
  1295. X           Leave(ml->menu)
  1296. X     Leave((MenuInfo *) 0)
  1297. X}
  1298. X
  1299. XRTLMenu create_menu(m)
  1300. XMenuInfo *m;
  1301. X{
  1302. X     ActionLine *ln;
  1303. X     RTLMenuItem tmp;
  1304. X     MenuInfo *side_menu;
  1305. X
  1306. X     Entry("create_menu")
  1307. X
  1308. X     if (!m)
  1309. X      yyerror("Internal error, create_menu passed null pointer");
  1310. X     /*
  1311. X      * Were we already created? This is possible if we were referenced
  1312. X      * by somebody created before us.
  1313. X      */
  1314. X     if (m->menu)
  1315. X      Leave(m->menu)
  1316. X     m->menu = RTLMenu_Create();
  1317. X     /* make a name (or picture) label for this menu */
  1318. X     tmp = RTLMenu_Append_Call(m->menu, m->name, m->pixmapname, do_nothing, 0);
  1319. X     RTLMenu_Label_Entry(m->menu, tmp);
  1320. X     ln = m->line;
  1321. X     if (!ln) {
  1322. X      yyerror("Internal error in create_menu.");
  1323. X      fprintf(stderr, "Menu '%s' has no line list.\n", m->name);
  1324. X      exit(1);
  1325. X     }
  1326. X     if (!ln->name && !ln->pixmapname) {
  1327. X      fprintf(stderr, "awm: Action in menu '%s' has no name or backing pixmap\n",
  1328. X          m->name);
  1329. X      yyerror(".. aborting\n");
  1330. X      exit(1);
  1331. X     }
  1332. X     while (ln) {
  1333. X      switch (ln->type) {
  1334. X      case IsVar:
  1335. X           ln->item = RTLMenu_Append_Checkback(m->menu, ln->name,
  1336. X                           ln->pixmapname,
  1337. X                           check_booleans,
  1338. X                           toggle_booleans,
  1339. X                           ln->text);
  1340. X           break;
  1341. X           
  1342. X      case IsImmFunction:
  1343. X           ln->item = RTLMenu_Append_Call(m->menu, ln->name,
  1344. X                          ln->pixmapname,
  1345. X                          do_imm_func, ln->func);
  1346. X           break;
  1347. X
  1348. X      case IsUwmFunction:
  1349. X           ln->item = RTLMenu_Append_Call(m->menu, ln->name,
  1350. X                          ln->pixmapname,
  1351. X                          do_awm_func, ln->func);
  1352. X           break;
  1353. X
  1354. X      case IsMenuFunction:
  1355. X           if (!(side_menu = FindMenu(ln->text))) {
  1356. X            fprintf(stderr, "Unknown menu \"%s\" referenced in ",
  1357. X            ln->text);
  1358. X            yyerror(" ..");
  1359. X            exit(1);
  1360. X           }
  1361. X           /* If we haven't created the referenced menu yet, create it now */
  1362. X           if (!side_menu->menu)
  1363. X            side_menu->menu = create_menu(side_menu);
  1364. X           ln->item = RTLMenu_Append_Submenu(m->menu, ln->name,
  1365. X                         ln->pixmapname,
  1366. X                         side_menu->menu);
  1367. X           break;
  1368. X           
  1369. X      case IsText:
  1370. X           ln->item = RTLMenu_Append_Call(m->menu, ln->name,
  1371. X                          ln->pixmapname,
  1372. X                          do_text, ln->text);
  1373. X           break;
  1374. X
  1375. X      case IsTextNL:
  1376. X           ln->item = RTLMenu_Append_Call(m->menu, ln->name,
  1377. X                          ln->pixmapname,
  1378. X                          do_text_nl, ln->text);
  1379. X           break;
  1380. X           
  1381. X      case IsShellCommand:
  1382. X           ln->item = RTLMenu_Append_Call(m->menu, ln->name,
  1383. X                          ln->pixmapname,
  1384. X                          do_shell, ln->text);
  1385. X           break;
  1386. X           
  1387. X      default:
  1388. X           fprintf(stderr, "create_menu, Unknown menu entry type %d\n",
  1389. X          ln->type);
  1390. X           break;
  1391. X      }
  1392. X      free(ln);
  1393. X      ln = ln->next;
  1394. X     }
  1395. X     Leave(m->menu)
  1396. X}
  1397. END_OF_awm/menu_sup.c
  1398. if test 6167 -ne `wc -c <awm/menu_sup.c`; then
  1399.     echo shar: \"awm/menu_sup.c\" unpacked with wrong size!
  1400. fi
  1401. # end of overwriting check
  1402. fi
  1403. if test -f awm/menus/menu.def.h -a "${1}" != "-c" ; then 
  1404.   echo shar: Will not over-write existing file \"awm/menus/menu.def.h\"
  1405. else
  1406. echo shar: Extracting \"awm/menus/menu.def.h\" \(6670 characters\)
  1407. sed "s/^X//" >awm/menus/menu.def.h <<'END_OF_awm/menus/menu.def.h'
  1408. X#ident   "%W% %G%"
  1409. X
  1410. X/*
  1411. X#ifndef lint
  1412. Xstatic char sccs_id[] = "@(#)menu.define.h    2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
  1413. X#endif
  1414. X*/
  1415. X
  1416. X
  1417. X/*
  1418. X  RTL Menu Package Version 1.0
  1419. X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
  1420. X
  1421. X  menu.h: macros for menu package
  1422. X
  1423. X#include "X11/copyright.h"
  1424. X/*
  1425. X *
  1426. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1427. X *
  1428. X * Copyright 1987 by Jordan Hubbard.
  1429. X *
  1430. X *
  1431. X *                         All Rights Reserved
  1432. X *
  1433. X * Permission to use, copy, modify, and distribute this software and its
  1434. X * documentation for any purpose and without fee is hereby granted,
  1435. X * provided that the above copyright notice appear in all copies and that
  1436. X * both that copyright notice and this permission notice appear in
  1437. X * supporting documentation, and that the name of Ardent Computer
  1438. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1439. X * pertaining to distribution of the software without specific, written
  1440. X * prior permission.
  1441. X *
  1442. X */
  1443. X
  1444. X/*
  1445. X
  1446. XCopyright 1987 by
  1447. X    Siemens Corporate Research and Support, Inc., Princeton, New Jersey
  1448. X
  1449. XPermission to use, copy, modify, and distribute this software
  1450. Xand its documentation for any purpose and without fee is
  1451. Xhereby granted, provided that the above copyright notice
  1452. Xappear in all copies and that both that copyright notice and
  1453. Xthis permission notice appear in supporting documentation, and
  1454. Xthat the name of Siemens not be used in advertising or
  1455. Xpublicity pertaining to distribution of the software without
  1456. Xspecific, written prior permission.  Siemens makes no
  1457. Xrepresentations about the suitability of this software for any
  1458. Xpurpose.  It is provided "as is" without express or implied
  1459. Xwarranty.
  1460. X
  1461. X*/
  1462. X
  1463. X#ifndef bool
  1464. X#define bool    unsigned
  1465. X#endif 
  1466. X
  1467. X#ifndef FALSE
  1468. X#define    FALSE            0
  1469. X#define    TRUE            1
  1470. X#endif
  1471. X
  1472. X/* Menu data structure access macros */
  1473. X
  1474. X#define MenuWidth(menu) (menu)->menuWidth
  1475. X#define MenuHeight(menu) (menu)->menuHeight
  1476. X#define MenuOldWidth(menu) (menu)->menuOldWidth
  1477. X#define MenuOldHeight(menu) (menu)->menuOldHeight
  1478. X#define MenuItemWidth(menu) (menu)->menuItemWidth
  1479. X#define MenuFlags(menu) (menu)->menuFlags
  1480. X#define MenuMaxTextWidth(menu) (menu)->menuMaxTextWidth
  1481. X#define MenuBorderWidth(menu) MBorderWidth
  1482. X#define MenuOldBorderWidth(menu) (menu)->menuOldBorderWidth
  1483. X#define MenuItemPad(menu) MPad
  1484. X#define MenuDisplay(menu) (menu)->display
  1485. X#define MenuScreen(menu) (menu)->screen
  1486. X#define MenuWindow(menu) (menu)->menuWindow
  1487. X#define MenuCursor(menu) (menu)->menuCursor
  1488. X#define MenuSavedPixmap(menu) (menu)->savedPixmap
  1489. X#define MenuSavedImage(menu) ((menu)->savedImage)
  1490. X#define MenuSavedImageX(menu) (menu)->menuSavedImageX
  1491. X#define MenuSavedImageY(menu) (menu)->menuSavedImageY
  1492. X#define MenuItems(menu) (menu)->menuItems
  1493. X#define MenuFontInfo(menu) (menu)->menuFontInfo
  1494. X#define MenuNormalGC(menu) (menu)->normalGC
  1495. X#define MenuInvertGC(menu) (menu)->invertGC
  1496. X#define MenuHighlightedGC(menu) (menu)->highlightedGC
  1497. X#define MenuGreyGC(menu) (menu)->greyGC
  1498. X#define MenuGreyPixmap(menu) (menu)->greyPixmap
  1499. X#define MenuCheckmarkPixmap(menu) (menu)->checkmarkPixmap
  1500. X#define MenuArrowPixmap(menu) (menu)->arrowPixmap
  1501. X#define MenuInitialItemText(menu) (menu)->menuInitialItemText
  1502. X#define MenuItemHighlighted(menu) (menu)->highlightedItem
  1503. X#define MenuNested(menu) (menu)->menuNested
  1504. X#define MenuX(menu) (menu)->menuX
  1505. X#define MenuY(menu) (menu)->menuY
  1506. X#define MenuParent(menu) (menu)->parentMenu
  1507. X#define MenuDelta(menu) MDelta
  1508. X#define MenuOptions(menu) (menu)->menuOptions
  1509. X#define NULLMENU ((Menu *) NULL)
  1510. X
  1511. X/* Menu predicates */
  1512. X
  1513. X#define MenuIsNull(menu) (menu == NULLMENU)
  1514. X#define MenuIsDisplayed(menu) (menu->menuFlags & menuMapped)
  1515. X#define MenuHasInitialItem(menu) (menu->menuInitialItemText != (char *) NULL)
  1516. X
  1517. X/* Menu modifiers */
  1518. X
  1519. X#define SetHighlightItem(menu, item) (menu->highlightedItem = item)
  1520. X#define ResetHighlightItem(menu) (menu->highlightedItem = NULLITEM)
  1521. X#define    SetMenuEventHandler(menu,f)    menu->menuEventHandler = f
  1522. X#define SetMenuFlag(menu, flag)     MenuFlags(menu) |= flag
  1523. X#define ResetMenuFlag(menu,flag)    MenuFlags(menu) &= ~flag
  1524. X#define TestMenuFlag(menu,flag)     (MenuFlags(menu) & flag)
  1525. X#define TestOptionFlag(menu,option) (MenuOptions(menu) & option)
  1526. X
  1527. X/* Item data structure access macros */
  1528. X
  1529. X#define ItemFlags(item) (item)->itemFlags
  1530. X#define ItemText(item) (item)->itemText
  1531. X#define ItemTextLength(item) (item)->itemTextLength
  1532. X#define ItemTextWidth(item) (item)->itemTextWidth
  1533. X#define ItemNext(item) (item)->nextItem
  1534. X#define ItemSubmenu(item) (item)->itemSubmenu
  1535. X#define ItemTag(item) (item)->itemTag
  1536. X#define ItemGenerator(item) (item)->generator
  1537. X#define ItemGeneratorParamPointer(item) (item)->genParamPointer
  1538. X#define ItemCheckproc(item) (item)->checkproc
  1539. X#define ItemCallback(item) (item)->itemCallback
  1540. X#define ItemData(item) (item)->itemData
  1541. X#define ItemWindow(item) (item)->itemWindow
  1542. X#define ItemMenu(item) (item)->itemMenu
  1543. X#define NULLITEM ((MenuItem *) NULL)
  1544. X#define ItemGetArrowPosition(item) (item->itemMenu->menuWidth - arrow_width)
  1545. X
  1546. X/* Item predicates */
  1547. X#define ItemIsNull(item) (item == NULLITEM)
  1548. X#define ItemIsInitialItem(menu, item) \
  1549. X    (MenuInitialItemText(menu) && \
  1550. X     (strcmp(MenuInitialItemText(menu), ItemText(item)) == 0))
  1551. X#define ItemIsLeaf(item) ((item->itemSubmenu == (Menu *) 0) ? TRUE : FALSE)
  1552. X#define ItemIsDisabled(item) (ItemFlags(item) & itemDisabled)
  1553. X#define ItemIsDeaf(item) (ItemFlags(item) & itemDeaf)
  1554. X
  1555. X/* Item modifiers */
  1556. X
  1557. X#define    CheckItem(menu,item)    SetItemCheck(menu,item,1)
  1558. X#define    DisableItem(menu,item)    SetItemDisable(menu,item,1)
  1559. X#define    EnableItem(menu,item)    SetItemDisable(menu,item,0)
  1560. X#define    UncheckItem(menu,item)    SetItemCheck(menu,item,0)
  1561. X#define SetItemFlag(item, flag) ItemFlags(item) |= flag
  1562. X#define ResetItemFlag(item,flag) ItemFlags(item) &= ~flag
  1563. X#define TestItemFlag(item,flag) (ItemFlags(item) & flag)
  1564. X#define MoveItemFlag(item,flag1,flag2) \
  1565. X    if (TestItemFlag(item,flag1))\
  1566. X        SetItemFlag(item,flag2);\
  1567. X    else\
  1568. X        ResetItemFlag(item,flag2);\
  1569. X    ResetItemFlag(item,flag1);
  1570. X
  1571. X/* Masks */
  1572. X
  1573. X#define MenuEventMask (LeaveWindowMask | EnterWindowMask | ButtonReleaseMask)
  1574. X#define NormalItemEventMask MenuEventMask
  1575. X#define SubmenuItemEventMask (MenuEventMask | PointerMotionMask)
  1576. X#define MenuIgnoreMask (unsigned long) 0
  1577. X
  1578. X/* Magic numbers */
  1579. X
  1580. X#define    checkMarkWidth        9
  1581. X#define    checkMarkHeight        8
  1582. X#define    defaultCursorWidth     16
  1583. X#define    defaultCursorHeight    16
  1584. X#define    defaultCursorX        1
  1585. X#define    defaultCursorY        1
  1586. X#define    lineSeparatorHeight    9
  1587. X
  1588. X/* external declarations */
  1589. X
  1590. Xextern Menu *NewMenu();
  1591. Xextern MenuItem *TrackMenu ();
  1592. Xextern MenuItem *MenuItemByName (), *Display_Menu(); 
  1593. Xextern void InitMenu ();
  1594. Xextern void DisposeMenu ();
  1595. Xextern void Draw_Menu();
  1596. END_OF_awm/menus/menu.def.h
  1597. if test 6670 -ne `wc -c <awm/menus/menu.def.h`; then
  1598.     echo shar: \"awm/menus/menu.def.h\" unpacked with wrong size!
  1599. fi
  1600. # end of overwriting check
  1601. fi
  1602. if test -f awm/menus/menu.h -a "${1}" != "-c" ; then 
  1603.   echo shar: Will not over-write existing file \"awm/menus/menu.h\"
  1604. else
  1605. echo shar: Extracting \"awm/menus/menu.h\" \(6217 characters\)
  1606. sed "s/^X//" >awm/menus/menu.h <<'END_OF_awm/menus/menu.h'
  1607. X#ident   "%W% %G%"
  1608. X
  1609. X/*
  1610. X#ifndef lint
  1611. Xstatic char sccs_id[] = "@(#)menu.h    2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
  1612. X#endif
  1613. X*/
  1614. X
  1615. X
  1616. X/* 
  1617. X  RTL Menu Package Version 1.0
  1618. X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
  1619. X
  1620. X  menu.h: menus header file
  1621. X  based on: menu.h    X10/6.6    11/3/86
  1622. X*/
  1623. X
  1624. X#include "X11/copyright.h"
  1625. X/*
  1626. X *
  1627. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1628. X *
  1629. X * Copyright 1987 by Jordan Hubbard.
  1630. X *
  1631. X *
  1632. X *                         All Rights Reserved
  1633. X *
  1634. X * Permission to use, copy, modify, and distribute this software and its
  1635. X * documentation for any purpose and without fee is hereby granted,
  1636. X * provided that the above copyright notice appear in all copies and that
  1637. X * both that copyright notice and this permission notice appear in
  1638. X * supporting documentation, and that the name of Ardent Computer
  1639. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1640. X * pertaining to distribution of the software without specific, written
  1641. X * prior permission.
  1642. X *
  1643. X */
  1644. X
  1645. X/*
  1646. X
  1647. XCopyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
  1648. X
  1649. XPermission to use, copy, modify, and distribute this
  1650. Xsoftware and its documentation for any purpose and without
  1651. Xfee is hereby granted, provided that the above copyright
  1652. Xnotice appear in all copies and that both that copyright
  1653. Xnotice and this permission notice appear in supporting
  1654. Xdocumentation, and that the name of M.I.T. not be used in
  1655. Xadvertising or publicity pertaining to distribution of the
  1656. Xsoftware without specific, written prior permission.
  1657. XM.I.T. makes no representations about the suitability of
  1658. Xthis software for any purpose.  It is provided "as is"
  1659. Xwithout express or implied warranty.
  1660. X
  1661. X*/
  1662. X
  1663. X/*
  1664. X
  1665. XCopyright 1987 by
  1666. X    Siemens Corporate Research and Support, Inc., Princeton, New Jersey
  1667. X
  1668. XPermission to use, copy, modify, and distribute this
  1669. Xsoftware and its documentation for any purpose and without
  1670. Xfee is hereby granted, provided that the above copyright
  1671. Xnotice appear in all copies and that both that copyright
  1672. Xnotice and this permission notice appear in supporting
  1673. Xdocumentation, and that the name of Siemens not be used in
  1674. Xadvertising or publicity pertaining to distribution of the
  1675. Xsoftware without specific, written prior permission.
  1676. XSiemens makes no representations about the suitability of
  1677. Xthis software for any purpose.  It is provided "as is"
  1678. Xwithout express or implied warranty.
  1679. X
  1680. X*/
  1681. X
  1682. X/*
  1683. X * Menu items are constructed as follows, starting from the left side:
  1684. X *
  1685. X *    menuItemPad
  1686. X *    space for check mark
  1687. X *    menuItemPad
  1688. X *    text + padding
  1689. X *    menuItemPad
  1690. X *
  1691. X * The padding for the text is that amount that this text is narrower than the
  1692. X * widest text.
  1693. X */
  1694. Xextern void Retch();
  1695. X
  1696. X#ifndef STD_DEFS
  1697. X#include "std_defs.h"
  1698. X#endif
  1699. X
  1700. X#ifndef OPTION_FLAGS
  1701. X#include "rtlmnu.opt.h"
  1702. X#endif
  1703. X
  1704. Xtypedef void (*Callback) ();
  1705. Xtypedef struct _menuItem MenuItem;
  1706. Xtypedef struct _menu Menu;
  1707. X
  1708. X/*
  1709. X * Special note for those familiar with the original RTL menus:
  1710. X * Where we used to keep height and width information for items
  1711. X * in the _menu structure, we now just keep width. Each item
  1712. X * can be of a different height, but is still constrained
  1713. X * to a fixed width (which is the width of the widest item in the
  1714. X * menu). We could allow variable widths, but the menu would look
  1715. X * like hell. We also allow arbitrary pixmap backgrounds for each
  1716. X * item now.
  1717. X */
  1718. Xstruct _menuItem {
  1719. X    int itemFlags;            /* flags of item */
  1720. X
  1721. X#define    itemDisabled        0x0001    /* item is disabled */
  1722. X#define    itemChecked        0x0002    /* item has check mark */
  1723. X#define itemDeaf        0x0004    /* item is a label */
  1724. X#define    itemChanged        0x0010    /* item desires change */
  1725. X    Pixmap itemBackground;        /* either zero or a pixmap */
  1726. X    char *itemText;            /* text of item (if no pixmap) */
  1727. X    unsigned int itemTextWidth;    /* width of text (or pixmap) */
  1728. X    unsigned int itemTextLength;    /* length of text */
  1729. X    unsigned int itemHeight;    /* height of this item */
  1730. X    struct _menuItem *nextItem;    /* next item in chain */
  1731. X    struct _menu *itemSubmenu;    /* For pull-right menus  */
  1732. X    Callback generator;        /* Change string and data */
  1733. X    caddr_t genParamPointer;    /* Address for generated parameter */
  1734. X    bool (*checkproc) ();            /* Checkmark callback generator */
  1735. X    Callback itemCallback;          /* user callback for item */
  1736. X    pointer itemData;               /* user data associated with menu */
  1737. X        Window  itemWindow;             /* window of item */
  1738. X        Menu *itemMenu;                 /* menu this item belongs to */
  1739. X};
  1740. X
  1741. Xstruct _menu {
  1742. X    unsigned int menuWidth;        /* full width of menu */
  1743. X    unsigned int menuHeight;    /* full height of menu */
  1744. X    unsigned int avgHeight;        /* Hack.. */
  1745. X        unsigned int menuOldWidth;
  1746. X        unsigned int menuOldHeight;
  1747. X        unsigned int menuItemWidth;     /* width of a menu item */
  1748. X    int menuFlags;            /* flags of this menu */
  1749. X
  1750. X# define    menuChanged    0x0001        /* menu changed, must redraw */
  1751. X# define    menuItemChanged    0x0002        /* item changed, must redraw */
  1752. X# define    menuMapped    0x0004        /* menu is now mapped */
  1753. X
  1754. X    unsigned int menuMaxTextWidth;    /* width of widest text */
  1755. X        unsigned int menuOldBorderWidth;
  1756. X    Display *display;        /* display of menu */
  1757. X    int screen;            /* screen on which to display menu */
  1758. X    Window menuWindow;        /* window of menu */
  1759. X    Cursor menuCursor;        /* cursor used in menu */
  1760. X    Pixmap savedPixmap;             /* for saving image under menu */
  1761. X    MenuItem *menuItems;        /* head of menu item chain */
  1762. X    XFontStruct *menuFontInfo;     /* Font info */
  1763. X    XFontStruct *boldFont;
  1764. X    GC normalGC;            /* Graphics contexts */
  1765. X    GC invertGC;            /* Used for inverting entries */
  1766. X    GC highlightedGC;        /* Highlighted text. */
  1767. X    GC boldGC;            /* For labels */
  1768. X    Pixmap greyPixmap;        /* Need to know what to free */
  1769. X    Pixmap checkmarkPixmap;        /* Pixmap for drawing check mark. */
  1770. X    Pixmap arrowPixmap;        /* Pixmap for drawing arrow. */
  1771. X    char *menuInitialItemText;      /* != NULL, initial item */
  1772. X    MenuItem *highlightedItem;    /* highlighted menu item */
  1773. X    int menuNested;            /* depth you are nested */
  1774. X    int menuX, menuY;        /* Menu position */
  1775. X        struct _menu *parentMenu;       /* menu to which you are a submenu
  1776. X                                         * (NULL if you are the root)
  1777. X                     */
  1778. X    MenuOptionsMask menuOptions;    /* option values for this menu */
  1779. X    };
  1780. END_OF_awm/menus/menu.h
  1781. if test 6217 -ne `wc -c <awm/menus/menu.h`; then
  1782.     echo shar: \"awm/menus/menu.h\" unpacked with wrong size!
  1783. fi
  1784. # end of overwriting check
  1785. fi
  1786. echo shar: End of archive 4 \(of 13\).
  1787. cp /dev/null ark4isdone
  1788. MISSING=""
  1789. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1790.     if test ! -f ark${I}isdone ; then
  1791.     MISSING="${MISSING} ${I}"
  1792.     fi
  1793. done
  1794. if test "${MISSING}" = "" ; then
  1795.     echo You have unpacked all 13 archives.
  1796.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1797. else
  1798.     echo You still need to unpack the following archives:
  1799.     echo "        " ${MISSING}
  1800. fi
  1801. ##  End of shell archive.
  1802. exit 0
  1803. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1804.